//---------------------------------------------------------------------------

#ifndef TConnectionListenerH
#define TConnectionListenerH
//---------------------------------------------------------------------------
#include "TRecvThread.h"
#include "TLogHandler.h"
using namespace gloox;
namespace WYHGloox
{
	class TConnListener : public ConnectionListener{
		private:
		   TNotifyEvent FOnConnect;
		   TOnDisConnect FOnDisConnect;
		   TOnTLSConnect FOnTLSConnect;
		   TOnLog FOnLog;
		   TRecvThread *recver;
		   TLogHandler *logger;
		protected:
			virtual void onConnect();
			virtual void onDisconnect(ConnectionError e);
			virtual bool onTLSConnect(const CertInfo &info);
			virtual ~TConnListener();
			void __fastcall KeepAlive(unsigned long timer);
		public:
			Client* client;
			TConnListener(std::string host);
			std::string UserName;
			std::string PassWord;
			std::string Host;
			std::string Resource;
			int Port;
			bool EnableRoster;
			bool EnableLogger;
			void __fastcall Connect();
			void __fastcall DisConnect();
		__property TNotifyEvent OnConnect={read=FOnConnect,write=FOnConnect};
		__property TOnDisConnect OnDisConnect={read=FOnDisConnect,write=FOnDisConnect};
		__property TOnTLSConnect OnTLSConnect={read=FOnTLSConnect,write=FOnTLSConnect};
		__property TOnLog OnLog={read=FOnLog,write=FOnLog};
	};

};
using namespace WYHGloox;
#endif
